package com.syni.mdd.sjb.common.datatreaure.controller.api;

import com.syni.mdd.sjb.common.component.utils.common.utils.RpcResponseVo;
import com.syni.mdd.sjb.common.component.utils.feign.dto.mdd.sjb.common.dxshapp.apiUserChannel.TransferManagerDto;
import com.syni.mdd.sjb.common.component.utils.feign.service.mdd.sjb.common.datatreasure.DxshUserChannelRestService;
import com.syni.mdd.sjb.common.component.utils.feign.service.mdd.commonuser.UserRestService;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppUserChannelService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/apiUserChannel")
public class DxshApiUserChannelRestApi implements DxshUserChannelRestService {

    @Autowired
    UserRestService userRestService;

    @Autowired
    DxshAppUserChannelService dxshAppUserChannelService;


    @PostMapping("/transferManager")
    @ApiOperation(value = "电享生活app调整管理员")
    public RpcResponseVo transferManager(@RequestBody TransferManagerDto transferManagerDto){

        return dxshAppUserChannelService.transferManager(transferManagerDto.getUserId(),transferManagerDto.getNewManagerId(),
                transferManagerDto.getBusinessId(),transferManagerDto.getChannel());
    }

    @PostMapping("/administratorReleaseBusiness")
    @ApiOperation(value = "后台解除管理员身份")
    public RpcResponseVo administratorReleaseBusiness(@RequestBody TransferManagerDto transferManagerDto){
        return dxshAppUserChannelService.administratorReleaseBusiness(transferManagerDto.getUserId(),
                transferManagerDto.getBusinessId(),transferManagerDto.getAssistantIds());
    }

    @GetMapping("/getMinAppRevDataByStoreId")
    @ApiOperation(value = "获取小程序相关信息")
    public Map<String,Object> getMinAppRevDataByStoreId(@RequestParam(value = "storeId",required = false) String storeId
    ,@RequestParam(value = "appId",required = false) String appId){
        return dxshAppUserChannelService.getMinAppRevDataByStoreId(storeId,appId);
    }
}
